﻿package birdry.utils	{
	import flash.geom.Point;
	
	//	birdry.utils.MathUtil;
	
	
	public class MathUtil	{
		/**
		* StringUtil.getRandomInt(5,10);	-->		"5~10(random)";
		* @param	Mi	:	Number
		* @param	Ma	:	Number
		* @return
		*/
		public static function getRandomInt(Mi:Number, Ma:Number):int  {   
			return Math.floor(Math.random()*(Ma-Mi+1))+Mi;
		}
		
		
		public static function pointToRadian(point1:Point, point2:Point): Number	{
			var tempRadian:Number = Math.atan2((point2.x  - point1.x), (point2.y - point1.y)) + Math.PI;
			var tempAng:Number = tempRadian * -180 / Math.PI;
			return tempAng;
		}
		
		public static function angleToRadian( angle : Number ) : Number		{
			var radian : Number = Math.PI/180*angle
			return radian
		}
		
		public static function returnSlideListLimit(total:uint, viewAmount:uint, currentNum:int): uint	{
			if (currentNum < 0 || total <= viewAmount)	{
				currentNum = 0;
			}	else 	{
				if (currentNum > total - viewAmount)	currentNum = total - viewAmount;
			}
			return currentNum;
		}
	}	// class
}	// package